<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>我的钱包</title>
    <link rel="stylesheet" type="text/css" href="../../../css/aui/aui.css" />
    <style>
        #header {
            height: 11rem;
            background: linear-gradient(to right, #01A2FF, #3285FF);
            padding-top: 25px;
            color: #fff;
        }

        .wallet {
            text-align: center;
        }

        .row_flex {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 0.5rem;
            border-top: 1px solid rgba(255, 255, 255, 0.1);
            line-height: 2.25rem;
        }

        .fengexian {
            width: 1px;
            height: 1.5rem;
            background: rgba(255, 255, 255, 0.1);
        }

        .money_icon {
            width: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .money_icon img {
            width: 0.8rem;
            height: 0.8rem;
            margin-right: 0.3rem;
        }
    </style>
</head>

<body>
    <div id="header">
        <header class="aui-bar aui-bar-nav" style="background:rgba(0,0,0,0);">
            <div class="aui-pull-left aui-btn">
                <span class="aui-iconfont aui-icon-left" onclick="close_w()"></span>
            </div>
            <div class="aui-title">我的钱包</div>
        </header>
        <div class="wallet">
            <div>￥<span style="font-size:1.5rem;">{{wallet_balance}}</span></div>
            <div><small>余额</small></div>
            <div class="row_flex">
                <div class="money_icon" @click="openWin('zaixian_chongzhi')"><img src="../../../image/icon/01chongzhi.png" alt="">在线充值</div>
                <div class="fengexian"></div>
                <div class="money_icon" @click="openWin('tixian')"><img src="../../../image/icon/02xiaofei.png" alt="">提现</div>
            </div>
        </div>
    </div>

</body>
<script src="../../../script/api.js" charset="utf-8"></script>
<script src="../../../script/common/jquery-3.3.1.min.js" charset="utf-8"></script>
<script src="../../../script/common/common.js" charset="utf-8"></script>
<script src="../../../script/common/config.js" charset="utf-8"></script>
<script src="../../../script/common/vue.min.js" charset="utf-8"></script>
<script>
    apiready = function() {
        api.parseTapmode();
        vm.init();

    }

    var vm = new Vue({
        el: "#header",
        data: {
            userInfo: {},
            wallet_balance: 0,
        },
        methods: {
            init() {
                this.userInfo = get_local("userInfo");
                this.getUserBalance();
                this.openFrame();
            },
            getUserBalance() {
                var that = this;
                // 用户钱包信息
                _ajax(Config.api.UserGetUserBalance, {
                    user_id: this.userInfo.user_id
                }, function(ret) {
                    if (ret.code === 200) {
                        that.wallet_balance = ret.data.wallet_balance;
                    }
                });
            },
            openFrame() {
                var name = "my_wallet_frm";
                var url = "./my_wallet_frm.html";
                var frameheight = api.winHeight - $("#header").height();
                api.openFrame({
                    name: name,
                    url: url,
                    rect: {
                        x: 0,
                        y: $("#header").height(),
                        w: 'auto',
                        h: frameheight
                    },
                });
            },
            openWin(name) {
                var winInfo = {
                    zaixian_chongzhi: {
                        name: 'zaixian_chongzhi_win',
                        url: './zaixian_chongzhi/zaixian_chongzhi_win.html'
                    },
                    tixian: {
                        name: 'tixian_win',
                        url: './tixian/tixian_win.html'
                    }
                };
                if (name) {
                    open_w(winInfo[name].name, winInfo[name].url);
                } else {
                    $toast("正在开发中...");
                }
            }
        }
    });
</script>

</html>
